<template>
  <div class="container">
    <van-nav-bar fixed title="分类" />
    <van-grid :gutter="20" :column-num="2">
      <van-grid-item
        :to="`/list?id=${item.id}&index=${index}`"
        v-for="(item, index) in cateList"
        :key="item.id"
        :icon="`${item.icon.split('-')[1]}`"
        icon-prefix="fa"
        :text="item.catename"
      />
    </van-grid>
  </div>
</template>

<script>
import { mapActions, mapState } from "vuex";
export default {
  computed:{
    ...mapState('cate',['cateList'])
  },
  created() {
    this.getCateList();
  },
  methods: {
    ...mapActions('cate',["getCateList"]),
  },
};
</script>

<style scoped lang="less">
.van-grid {
  margin-top: 40px;
}
</style>